package cn.edu.cqu.zhihucrawler2.commen;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ListAdapter;
import android.widget.ListView;

import java.util.AbstractMap;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

public class CommenValue
{
    //https://www.zhihu.com/topic/XXX/hot
    public static LinkedList<Map.Entry<String,String>> answerURL1 = new LinkedList<Map.Entry<String, String>>()
    {
        {
//            法律
            add(new AbstractMap.SimpleEntry<String, String>("法律","19550874"));
            add(new AbstractMap.SimpleEntry<String, String>("法律常识","19645023"));
            add(new AbstractMap.SimpleEntry<String, String>("法律咨询","19580772"));
            add(new AbstractMap.SimpleEntry<String, String>("中国法律","19647334"));
            add(new AbstractMap.SimpleEntry<String, String>("政治与法律","19793721"));
        }
    };

    public static LinkedList<Map.Entry<String,String>> answerURL2 = new LinkedList<Map.Entry<String, String>>()
    {
        {
//            信用卡诈骗
            add(new AbstractMap.SimpleEntry<String, String>("诈骗","19588459"));
            add(new AbstractMap.SimpleEntry<String, String>("网络诈骗","19863463"));
            add(new AbstractMap.SimpleEntry<String, String>("骗局（诈骗）","20071663"));
            add(new AbstractMap.SimpleEntry<String, String>("诈骗电话","19780991"));
        }
    };

    public static LinkedList<Map.Entry<String,String>> answerURL3 = new LinkedList<Map.Entry<String, String>>()
    {
        {
//            交通肇事
            add(new AbstractMap.SimpleEntry<String, String>("交通肇事","19555959"));
        }
    };

    public static LinkedList<Map.Entry<String,String>> answerURL4 = new LinkedList<Map.Entry<String, String>>()
    {
        {
//            贩毒
            add(new AbstractMap.SimpleEntry<String, String>("贩毒","19696245"));
        }
    };

    public static LinkedList<Map.Entry<String,String>> answerURL5 = new LinkedList<Map.Entry<String, String>>()
    {
        {
//            抢劫
            add(new AbstractMap.SimpleEntry<String, String>("抢劫","19643078"));
        }
    };

    public static LinkedList<Map.Entry<String,String>> answerURL6 = new LinkedList<Map.Entry<String, String>>()
    {
        {
//            盗窃
            add(new AbstractMap.SimpleEntry<String, String>("盗窃","19591296"));
            add(new AbstractMap.SimpleEntry<String, String>("盗窃罪","20034761"));
        }
    };

    public static LinkedList<Map.Entry<String,String>> answerURL7 = new LinkedList<Map.Entry<String, String>>()
    {
        {
//            绑架
            add(new AbstractMap.SimpleEntry<String, String>("绑架","19678724"));
            add(new AbstractMap.SimpleEntry<String, String>("道德绑架","19837337"));
        }
    };

    public static LinkedList<Map.Entry<String,String>> articleURL = new LinkedList<Map.Entry<String, String>>()
    {
        {

//            法律
            add(new AbstractMap.SimpleEntry<String, String>("法律那些事儿","goallawyer"));
            add(new AbstractMap.SimpleEntry<String, String>("互联网法律观察","mclawman"));
            add(new AbstractMap.SimpleEntry<String, String>("法律、保险和面子","c_34899953"));
            add(new AbstractMap.SimpleEntry<String, String>("法律评论","shixiaolong"));
            add(new AbstractMap.SimpleEntry<String, String>("硅谷八卦及创业法律","SVlaw"));
            add(new AbstractMap.SimpleEntry<String, String>("法律答问","51laweasy"));
            add(new AbstractMap.SimpleEntry<String, String>("法律匠人","wangrenlvshi"));
//            诈骗
            add(new AbstractMap.SimpleEntry<String, String>("终结诈骗","zhongjiezhapian"));
            add(new AbstractMap.SimpleEntry<String, String>("天上不会掉馅饼","wontfallinyourlap"));
        }
    };

    public static void setListViewHeightBasedOnChildren(ListView listView) {
        ListAdapter listAdapter = listView.getAdapter();
        if (listAdapter == null) {
            return;
        }

        int totalHeight = 0;
        for (int i = 0; i < listAdapter.getCount(); i++) {
            View listItem = listAdapter.getView(i, null, listView);
            listItem.measure(0, 0);  // 获取item高度
            totalHeight += listItem.getMeasuredHeight();
        }

        ViewGroup.LayoutParams params = listView.getLayoutParams();
        // 最后再加上分割线的高度和padding高度，否则显示不完整。
        params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1))+listView.getPaddingTop()+listView.getPaddingBottom();
        listView.setLayoutParams(params);
    }

//    public static HashMap<String,String> articleURL2 = new HashMap<String,String>()
//    {
//        {
////            信用卡诈骗
//            put("诈骗","19588459");
//            put("网络诈骗","19863463");
//            put("骗局（诈骗）","20071663");
//            put("诈骗电话","19780991");
//        }
//    };
//
//    public static HashMap<String,String> articleURL3 = new HashMap<String,String>()
//    {
//        {
////            交通肇事
//            put("交通肇事","19555959");
//        }
//    };
//
//    public static HashMap<String,String> articleURL4 = new HashMap<String,String>()
//    {
//        {
////            贩毒
//            put("贩毒","19696245");
//        }
//    };
//
//    public static HashMap<String,String> articleURL5 = new HashMap<String,String>()
//    {
//        {
////            抢劫
//            put("抢劫","19643078");
//        }
//    };
//
//    public static HashMap<String,String> articleURL6 = new HashMap<String,String>()
//    {
//        {
////            盗窃
//            put("盗窃","19591296");
//            put("盗窃罪","20034761");
//        }
//    };
//
//    public static HashMap<String,String> articleURL7 = new HashMap<String,String>()
//    {
//        {
////            绑架
//            put("绑架","19678724");
//            put("道德绑架","19837337");
//        }
//    };
}
